<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 1987-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation.  A copy of
the license is included in the
section entitled "GNU Free Documentation License".

This manual contains no Invariant Sections.  The Front-Cover Texts are
(a) (see below), and the Back-Cover Texts are (b) (see below).

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Invocation (The C Preprocessor)</title>

<meta name="description" content="Invocation (The C Preprocessor)">
<meta name="keywords" content="Invocation (The C Preprocessor)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Index-of-Directives.html" rel="index" title="Index of Directives">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html" rel="up" title="Top">
<link href="Environment-Variables.html" rel="next" title="Environment Variables">
<link href="Implementation-Details.html" rel="prev" title="Implementation Details">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span.r {font-family: initial; font-weight: normal; font-style: normal}
span:hover a.copiable-link {visibility: visible}
-->
</style>


</head>

<body lang="en">
<div class="chapter-level-extent" id="Invocation">
<div class="nav-panel">
<p>
Next: <a href="Environment-Variables.html" accesskey="n" rel="next">Environment Variables</a>, Previous: <a href="Implementation-Details.html" accesskey="p" rel="prev">Implementation Details</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-Directives.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h2 class="chapter" id="Invocation-1"><span>12 Invocation<a class="copiable-link" href="#Invocation-1"> &para;</a></span></h2>
<a class="index-entry-id" id="index-invocation"></a>
<a class="index-entry-id" id="index-command-line"></a>

<p>Most often when you use the C preprocessor you do not have to invoke it
explicitly: the C compiler does so automatically.  However, the
preprocessor is sometimes useful on its own.  You can invoke the 
preprocessor either with the <code class="command">cpp</code> command, or via <code class="command">gcc -E</code>.
In GCC, the preprocessor is actually integrated with the compiler
rather than a separate program, and both of these commands invoke
GCC and tell it to stop after the preprocessing phase.
</p>
<p>The <code class="command">cpp</code> options listed here are also accepted by
<code class="command">gcc</code> and have the same meaning.  Likewise the <code class="command">cpp</code>
command accepts all the usual <code class="command">gcc</code> driver options, although those
pertaining to compilation phases after preprocessing are ignored.
</p>
<p>Only options specific to preprocessing behavior are documented here.
Refer to the GCC manual for full documentation of other driver options.
</p>

<p>The <code class="command">cpp</code> command expects two file names as arguments, <var class="var">infile</var> and
<var class="var">outfile</var>.  The preprocessor reads <var class="var">infile</var> together with any
other files it specifies with &lsquo;<samp class="samp">#include</samp>&rsquo;.  All the output generated
by the combined input files is written in <var class="var">outfile</var>.
</p>
<p>Either <var class="var">infile</var> or <var class="var">outfile</var> may be <samp class="option">-</samp>, which as
<var class="var">infile</var> means to read from standard input and as <var class="var">outfile</var>
means to write to standard output.  If either file is omitted, it
means the same as if <samp class="option">-</samp> had been specified for that file.
You can also use the <samp class="option">-o <var class="var">outfile</var></samp> option to specify the 
output file.
</p>
<p>Unless otherwise noted, or the option ends in &lsquo;<samp class="samp">=</samp>&rsquo;, all options
which take an argument may have that argument appear either immediately
after the option, or with a space between option and argument:
<samp class="option">-Ifoo</samp> and <samp class="option">-I foo</samp> have the same effect.
</p>
<a class="index-entry-id" id="index-grouping-options"></a>
<a class="index-entry-id" id="index-options_002c-grouping"></a>
<p>Many options have multi-letter names; therefore multiple single-letter
options may <em class="emph">not</em> be grouped: <samp class="option">-dM</samp> is very different from
&lsquo;<samp class="samp">-d&nbsp;-M</samp>&rsquo;<!-- /@w -->.
</p>
<a class="index-entry-id" id="index-options"></a>

<dl class="table">
<dt><a id="index-D"></a><span><code class="code">-D <var class="var">name</var></code><a class="copiable-link" href="#index-D"> &para;</a></span></dt>
<dd><p>Predefine <var class="var">name</var> as a macro, with definition <code class="code">1</code>.
</p>
</dd>
<dt><code class="code">-D <var class="var">name</var>=<var class="var">definition</var></code></dt>
<dd><p>The contents of <var class="var">definition</var> are tokenized and processed as if
they appeared during translation phase three in a &lsquo;<samp class="samp">#define</samp>&rsquo;
directive.  In particular, the definition is truncated by
embedded newline characters.
</p>
<p>If you are invoking the preprocessor from a shell or shell-like
program you may need to use the shell&rsquo;s quoting syntax to protect
characters such as spaces that have a meaning in the shell syntax.
</p>
<p>If you wish to define a function-like macro on the command line, write
its argument list with surrounding parentheses before the equals sign
(if any).  Parentheses are meaningful to most shells, so you should
quote the option.  With <code class="command">sh</code> and <code class="command">csh</code>,
<samp class="option">-D'<var class="var">name</var>(<var class="var">args&hellip;</var>)=<var class="var">definition</var>'</samp> works.
</p>
<p><samp class="option">-D</samp> and <samp class="option">-U</samp> options are processed in the order they
are given on the command line.  All <samp class="option">-imacros <var class="var">file</var></samp> and
<samp class="option">-include <var class="var">file</var></samp> options are processed after all
<samp class="option">-D</samp> and <samp class="option">-U</samp> options.
</p>
</dd>
<dt><a id="index-U"></a><span><code class="code">-U <var class="var">name</var></code><a class="copiable-link" href="#index-U"> &para;</a></span></dt>
<dd><p>Cancel any previous definition of <var class="var">name</var>, either built in or
provided with a <samp class="option">-D</samp> option.
</p>
</dd>
<dt><a id="index-include"></a><span><code class="code">-include <var class="var">file</var></code><a class="copiable-link" href="#index-include"> &para;</a></span></dt>
<dd><p>Process <var class="var">file</var> as if <code class="code">#include &quot;file&quot;</code> appeared as the first
line of the primary source file.  However, the first directory searched
for <var class="var">file</var> is the preprocessor&rsquo;s working directory <em class="emph">instead of</em>
the directory containing the main source file.  If not found there, it
is searched for in the remainder of the <code class="code">#include &quot;&hellip;&quot;</code> search
chain as normal.
</p>
<p>If multiple <samp class="option">-include</samp> options are given, the files are included
in the order they appear on the command line.
</p>
</dd>
<dt><a id="index-imacros"></a><span><code class="code">-imacros <var class="var">file</var></code><a class="copiable-link" href="#index-imacros"> &para;</a></span></dt>
<dd><p>Exactly like <samp class="option">-include</samp>, except that any output produced by
scanning <var class="var">file</var> is thrown away.  Macros it defines remain defined.
This allows you to acquire all the macros from a header without also
processing its declarations.
</p>
<p>All files specified by <samp class="option">-imacros</samp> are processed before all files
specified by <samp class="option">-include</samp>.
</p>
</dd>
<dt><a id="index-undef"></a><span><code class="code">-undef</code><a class="copiable-link" href="#index-undef"> &para;</a></span></dt>
<dd><p>Do not predefine any system-specific or GCC-specific macros.  The
standard predefined macros remain defined.
See <a class="xref" href="Standard-Predefined-Macros.html">Standard Predefined Macros</a>.
</p>
</dd>
<dt><a id="index-pthread"></a><span><code class="code">-pthread</code><a class="copiable-link" href="#index-pthread"> &para;</a></span></dt>
<dd><p>Define additional macros required for using the POSIX threads library.
You should use this option consistently for both compilation and linking.
This option is supported on GNU/Linux targets, most other Unix derivatives,
and also on x86 Cygwin and MinGW targets.
</p>
</dd>
<dt><a class="index-entry-id" id="index-make"></a>
<a class="index-entry-id" id="index-dependencies_002c-make"></a>
<a id="index-M"></a><span><code class="code">-M</code><a class="copiable-link" href="#index-M"> &para;</a></span></dt>
<dd><p>Instead of outputting the result of preprocessing, output a rule
suitable for <code class="command">make</code> describing the dependencies of the main
source file.  The preprocessor outputs one <code class="command">make</code> rule containing
the object file name for that source file, a colon, and the names of all
the included files, including those coming from <samp class="option">-include</samp> or
<samp class="option">-imacros</samp> command-line options.
</p>
<p>Unless specified explicitly (with <samp class="option">-MT</samp> or <samp class="option">-MQ</samp>), the
object file name consists of the name of the source file with any
suffix replaced with object file suffix and with any leading directory
parts removed.  If there are many included files then the rule is
split into several lines using &lsquo;<samp class="samp">\</samp>&rsquo;-newline.  The rule has no
commands.
</p>
<p>This option does not suppress the preprocessor&rsquo;s debug output, such as
<samp class="option">-dM</samp>.  To avoid mixing such debug output with the dependency
rules you should explicitly specify the dependency output file with
<samp class="option">-MF</samp>, or use an environment variable like
<code class="env">DEPENDENCIES_OUTPUT</code> (see <a class="pxref" href="Environment-Variables.html">Environment Variables</a>).  Debug output
is still sent to the regular output stream as normal.
</p>
<p>Passing <samp class="option">-M</samp> to the driver implies <samp class="option">-E</samp>, and suppresses
warnings with an implicit <samp class="option">-w</samp>.
</p>
</dd>
<dt><a id="index-MM"></a><span><code class="code">-MM</code><a class="copiable-link" href="#index-MM"> &para;</a></span></dt>
<dd><p>Like <samp class="option">-M</samp> but do not mention header files that are found in
system header directories, nor header files that are included,
directly or indirectly, from such a header.
</p>
<p>This implies that the choice of angle brackets or double quotes in an
&lsquo;<samp class="samp">#include</samp>&rsquo; directive does not in itself determine whether that
header appears in <samp class="option">-MM</samp> dependency output.
</p>
<a class="anchor" id="dashMF"></a></dd>
<dt><a id="index-MF"></a><span><code class="code">-MF <var class="var">file</var></code><a class="copiable-link" href="#index-MF"> &para;</a></span></dt>
<dd><p>When used with <samp class="option">-M</samp> or <samp class="option">-MM</samp>, specifies a
file to write the dependencies to.  If no <samp class="option">-MF</samp> switch is given
the preprocessor sends the rules to the same place it would send
preprocessed output.
</p>
<p>When used with the driver options <samp class="option">-MD</samp> or <samp class="option">-MMD</samp>,
<samp class="option">-MF</samp> overrides the default dependency output file.
</p>
<p>If <var class="var">file</var> is <samp class="file">-</samp>, then the dependencies are written to <samp class="file">stdout</samp>.
</p>
</dd>
<dt><a id="index-MG"></a><span><code class="code">-MG</code><a class="copiable-link" href="#index-MG"> &para;</a></span></dt>
<dd><p>In conjunction with an option such as <samp class="option">-M</samp> requesting
dependency generation, <samp class="option">-MG</samp> assumes missing header files are
generated files and adds them to the dependency list without raising
an error.  The dependency filename is taken directly from the
<code class="code">#include</code> directive without prepending any path.  <samp class="option">-MG</samp>
also suppresses preprocessed output, as a missing header file renders
this useless.
</p>
<p>This feature is used in automatic updating of makefiles.
</p>
</dd>
<dt><a id="index-Mno_002dmodules"></a><span><code class="code">-Mno-modules</code><a class="copiable-link" href="#index-Mno_002dmodules"> &para;</a></span></dt>
<dd><p>Disable dependency generation for compiled module interfaces.
</p>
</dd>
<dt><a id="index-MP"></a><span><code class="code">-MP</code><a class="copiable-link" href="#index-MP"> &para;</a></span></dt>
<dd><p>This option instructs CPP to add a phony target for each dependency
other than the main file, causing each to depend on nothing.  These
dummy rules work around errors <code class="command">make</code> gives if you remove header
files without updating the <samp class="file">Makefile</samp> to match.
</p>
<p>This is typical output:
</p>
<div class="example smallexample">
<pre class="example-preformatted">test.o: test.c test.h

test.h:
</pre></div>

</dd>
<dt><a id="index-MT"></a><span><code class="code">-MT <var class="var">target</var></code><a class="copiable-link" href="#index-MT"> &para;</a></span></dt>
<dd>
<p>Change the target of the rule emitted by dependency generation.  By
default CPP takes the name of the main input file, deletes any
directory components and any file suffix such as &lsquo;<samp class="samp">.c</samp>&rsquo;, and
appends the platform&rsquo;s usual object suffix.  The result is the target.
</p>
<p>An <samp class="option">-MT</samp> option sets the target to be exactly the string you
specify.  If you want multiple targets, you can specify them as a single
argument to <samp class="option">-MT</samp>, or use multiple <samp class="option">-MT</samp> options.
</p>
<p>For example, <samp class="option">-MT&nbsp;'$(objpfx)foo.o'<!-- /@w --></samp> might give
</p>
<div class="example smallexample">
<pre class="example-preformatted">$(objpfx)foo.o: foo.c
</pre></div>

</dd>
<dt><a id="index-MQ"></a><span><code class="code">-MQ <var class="var">target</var></code><a class="copiable-link" href="#index-MQ"> &para;</a></span></dt>
<dd>
<p>Same as <samp class="option">-MT</samp>, but it quotes any characters which are special to
Make.  <samp class="option">-MQ&nbsp;'$(objpfx)foo.o'<!-- /@w --></samp> gives
</p>
<div class="example smallexample">
<pre class="example-preformatted">$$(objpfx)foo.o: foo.c
</pre></div>

<p>The default target is automatically quoted, as if it were given with
<samp class="option">-MQ</samp>.
</p>
</dd>
<dt><a id="index-MD"></a><span><code class="code">-MD</code><a class="copiable-link" href="#index-MD"> &para;</a></span></dt>
<dd><p><samp class="option">-MD</samp> is equivalent to <samp class="option">-M -MF <var class="var">file</var></samp>, except that
<samp class="option">-E</samp> is not implied.  The driver determines <var class="var">file</var> based on
whether an <samp class="option">-o</samp> option is given.  If it is, the driver uses its
argument but with a suffix of <samp class="file">.d</samp>, otherwise it takes the name
of the input file, removes any directory components and suffix, and
applies a <samp class="file">.d</samp> suffix.
</p>
<p>If <samp class="option">-MD</samp> is used in conjunction with <samp class="option">-E</samp>, any
<samp class="option">-o</samp> switch is understood to specify the dependency output file
(see <a class="pxref" href="#dashMF">-MF</a>), but if used without <samp class="option">-E</samp>, each <samp class="option">-o</samp>
is understood to specify a target object file.
</p>
<p>Since <samp class="option">-E</samp> is not implied, <samp class="option">-MD</samp> can be used to generate
a dependency output file as a side effect of the compilation process.
</p>
</dd>
<dt><a id="index-MMD"></a><span><code class="code">-MMD</code><a class="copiable-link" href="#index-MMD"> &para;</a></span></dt>
<dd><p>Like <samp class="option">-MD</samp> except mention only user header files, not system
header files.
</p>
</dd>
<dt><a id="index-fpreprocessed"></a><span><code class="code">-fpreprocessed</code><a class="copiable-link" href="#index-fpreprocessed"> &para;</a></span></dt>
<dd><p>Indicate to the preprocessor that the input file has already been
preprocessed.  This suppresses things like macro expansion, trigraph
conversion, escaped newline splicing, and processing of most directives.
The preprocessor still recognizes and removes comments, so that you can
pass a file preprocessed with <samp class="option">-C</samp> to the compiler without
problems.  In this mode the integrated preprocessor is little more than
a tokenizer for the front ends.
</p>
<p><samp class="option">-fpreprocessed</samp> is implicit if the input file has one of the
extensions &lsquo;<samp class="samp">.i</samp>&rsquo;, &lsquo;<samp class="samp">.ii</samp>&rsquo; or &lsquo;<samp class="samp">.mi</samp>&rsquo;.  These are the
extensions that GCC uses for preprocessed files created by
<samp class="option">-save-temps</samp>.
</p>
</dd>
<dt><a id="index-fdirectives_002donly"></a><span><code class="code">-fdirectives-only</code><a class="copiable-link" href="#index-fdirectives_002donly"> &para;</a></span></dt>
<dd><p>When preprocessing, handle directives, but do not expand macros.
</p>
<p>The option&rsquo;s behavior depends on the <samp class="option">-E</samp> and <samp class="option">-fpreprocessed</samp>
options.
</p>
<p>With <samp class="option">-E</samp>, preprocessing is limited to the handling of directives
such as <code class="code">#define</code>, <code class="code">#ifdef</code>, and <code class="code">#error</code>.  Other
preprocessor operations, such as macro expansion and trigraph
conversion are not performed.  In addition, the <samp class="option">-dD</samp> option is
implicitly enabled.
</p>
<p>With <samp class="option">-fpreprocessed</samp>, predefinition of command line and most
builtin macros is disabled.  Macros such as <code class="code">__LINE__</code>, which are
contextually dependent, are handled normally.  This enables compilation of
files previously preprocessed with <code class="code">-E -fdirectives-only</code>.
</p>
<p>With both <samp class="option">-E</samp> and <samp class="option">-fpreprocessed</samp>, the rules for
<samp class="option">-fpreprocessed</samp> take precedence.  This enables full preprocessing of
files previously preprocessed with <code class="code">-E -fdirectives-only</code>.
</p>
</dd>
<dt><a id="index-fdollars_002din_002didentifiers"></a><span><code class="code">-fdollars-in-identifiers</code><a class="copiable-link" href="#index-fdollars_002din_002didentifiers"> &para;</a></span></dt>
<dd><a class="anchor" id="fdollars_002din_002didentifiers"></a><p>Accept &lsquo;<samp class="samp">$</samp>&rsquo; in identifiers.
See <a class="xref" href="Implementation_002ddefined-behavior.html#Identifier-characters">Identifier characters</a>.
</p>
</dd>
<dt><a id="index-fextended_002didentifiers"></a><span><code class="code">-fextended-identifiers</code><a class="copiable-link" href="#index-fextended_002didentifiers"> &para;</a></span></dt>
<dd><p>Accept universal character names and extended characters in
identifiers.  This option is enabled by default for C99 (and later C
standard versions) and C++.
</p>
</dd>
<dt><a id="index-fno_002dcanonical_002dsystem_002dheaders"></a><span><code class="code">-fno-canonical-system-headers</code><a class="copiable-link" href="#index-fno_002dcanonical_002dsystem_002dheaders"> &para;</a></span></dt>
<dd><p>When preprocessing, do not shorten system header paths with canonicalization.
</p>
</dd>
<dt><a id="index-fmax_002dinclude_002ddepth"></a><span><code class="code">-fmax-include-depth=<var class="var">depth</var></code><a class="copiable-link" href="#index-fmax_002dinclude_002ddepth"> &para;</a></span></dt>
<dd><p>Set the maximum depth of the nested #include. The default is 200. 
</p>
</dd>
<dt><a id="index-ftabstop"></a><span><code class="code">-ftabstop=<var class="var">width</var></code><a class="copiable-link" href="#index-ftabstop"> &para;</a></span></dt>
<dd><p>Set the distance between tab stops.  This helps the preprocessor report
correct column numbers in warnings or errors, even if tabs appear on the
line.  If the value is less than 1 or greater than 100, the option is
ignored.  The default is 8.
</p>
</dd>
<dt><a id="index-ftrack_002dmacro_002dexpansion"></a><span><code class="code">-ftrack-macro-expansion<span class="r">[</span>=<var class="var">level</var><span class="r">]</span></code><a class="copiable-link" href="#index-ftrack_002dmacro_002dexpansion"> &para;</a></span></dt>
<dd><p>Track locations of tokens across macro expansions. This allows the
compiler to emit diagnostic about the current macro expansion stack
when a compilation error occurs in a macro expansion. Using this
option makes the preprocessor and the compiler consume more
memory. The <var class="var">level</var> parameter can be used to choose the level of
precision of token location tracking thus decreasing the memory
consumption if necessary. Value &lsquo;<samp class="samp">0</samp>&rsquo; of <var class="var">level</var> de-activates
this option. Value &lsquo;<samp class="samp">1</samp>&rsquo; tracks tokens locations in a
degraded mode for the sake of minimal memory overhead. In this mode
all tokens resulting from the expansion of an argument of a
function-like macro have the same location. Value &lsquo;<samp class="samp">2</samp>&rsquo; tracks
tokens locations completely. This value is the most memory hungry.
When this option is given no argument, the default parameter value is
&lsquo;<samp class="samp">2</samp>&rsquo;.
</p>
<p>Note that <code class="code">-ftrack-macro-expansion=2</code> is activated by default.
</p>
</dd>
<dt><a id="index-fmacro_002dprefix_002dmap"></a><span><code class="code">-fmacro-prefix-map=<var class="var">old</var>=<var class="var">new</var></code><a class="copiable-link" href="#index-fmacro_002dprefix_002dmap"> &para;</a></span></dt>
<dd><p>When preprocessing files residing in directory <samp class="file"><var class="var">old</var></samp>,
expand the <code class="code">__FILE__</code> and <code class="code">__BASE_FILE__</code> macros as if the
files resided in directory <samp class="file"><var class="var">new</var></samp> instead.  This can be used
to change an absolute path to a relative path by using <samp class="file">.</samp> for
<var class="var">new</var> which can result in more reproducible builds that are
location independent.  This option also affects
<code class="code">__builtin_FILE()</code> during compilation.  See also
<samp class="option">-ffile-prefix-map</samp> and <samp class="option">-fcanon-prefix-map</samp>.
</p>
</dd>
<dt><a class="index-entry-id" id="index-character-set_002c-execution"></a>
<a id="index-fexec_002dcharset"></a><span><code class="code">-fexec-charset=<var class="var">charset</var></code><a class="copiable-link" href="#index-fexec_002dcharset"> &para;</a></span></dt>
<dd><p>Set the execution character set, used for string and character
constants.  The default is UTF-8.  <var class="var">charset</var> can be any encoding
supported by the system&rsquo;s <code class="code">iconv</code> library routine.
</p>
</dd>
<dt><a class="index-entry-id" id="index-character-set_002c-wide-execution"></a>
<a id="index-fwide_002dexec_002dcharset"></a><span><code class="code">-fwide-exec-charset=<var class="var">charset</var></code><a class="copiable-link" href="#index-fwide_002dexec_002dcharset"> &para;</a></span></dt>
<dd><p>Set the wide execution character set, used for wide string and
character constants.  The default is one of UTF-32BE, UTF-32LE, UTF-16BE,
or UTF-16LE, whichever corresponds to the width of <code class="code">wchar_t</code> and the
big-endian or little-endian byte order being used for code generation.  As
with <samp class="option">-fexec-charset</samp>, <var class="var">charset</var> can be any encoding supported
by the system&rsquo;s <code class="code">iconv</code> library routine; however, you will have
problems with encodings that do not fit exactly in <code class="code">wchar_t</code>.
</p>
</dd>
<dt><a class="index-entry-id" id="index-character-set_002c-input"></a>
<a id="index-finput_002dcharset"></a><span><code class="code">-finput-charset=<var class="var">charset</var></code><a class="copiable-link" href="#index-finput_002dcharset"> &para;</a></span></dt>
<dd><p>Set the input character set, used for translation from the character
set of the input file to the source character set used by GCC.  If the
locale does not specify, or GCC cannot get this information from the
locale, the default is UTF-8.  This can be overridden by either the locale
or this command-line option.  Currently the command-line option takes
precedence if there&rsquo;s a conflict.  <var class="var">charset</var> can be any encoding
supported by the system&rsquo;s <code class="code">iconv</code> library routine.
</p>

</dd>
<dt><a class="index-entry-id" id="index-fno_002dworking_002ddirectory"></a>
<a id="index-fworking_002ddirectory"></a><span><code class="code">-fworking-directory</code><a class="copiable-link" href="#index-fworking_002ddirectory"> &para;</a></span></dt>
<dd><p>Enable generation of linemarkers in the preprocessor output that
let the compiler know the current working directory at the time of
preprocessing.  When this option is enabled, the preprocessor
emits, after the initial linemarker, a second linemarker with the
current working directory followed by two slashes.  GCC uses this
directory, when it&rsquo;s present in the preprocessed input, as the
directory emitted as the current working directory in some debugging
information formats.  This option is implicitly enabled if debugging
information is enabled, but this can be inhibited with the negated
form <samp class="option">-fno-working-directory</samp>.  If the <samp class="option">-P</samp> flag is
present in the command line, this option has no effect, since no
<code class="code">#line</code> directives are emitted whatsoever.
</p>
</dd>
<dt><a id="index-A"></a><span><code class="code">-A <var class="var">predicate</var>=<var class="var">answer</var></code><a class="copiable-link" href="#index-A"> &para;</a></span></dt>
<dd><p>Make an assertion with the predicate <var class="var">predicate</var> and answer
<var class="var">answer</var>.  This form is preferred to the older form <samp class="option">-A
<var class="var">predicate</var>(<var class="var">answer</var>)</samp>, which is still supported, because
it does not use shell special characters.
See <a class="xref" href="Obsolete-Features.html">Obsolete Features</a>.
</p>
</dd>
<dt><code class="code">-A -<var class="var">predicate</var>=<var class="var">answer</var></code></dt>
<dd><p>Cancel an assertion with the predicate <var class="var">predicate</var> and answer
<var class="var">answer</var>.
</p>
</dd>
<dt><a id="index-C"></a><span><code class="code">-C</code><a class="copiable-link" href="#index-C"> &para;</a></span></dt>
<dd><p>Do not discard comments.  All comments are passed through to the output
file, except for comments in processed directives, which are deleted
along with the directive.
</p>
<p>You should be prepared for side effects when using <samp class="option">-C</samp>; it
causes the preprocessor to treat comments as tokens in their own right.
For example, comments appearing at the start of what would be a
directive line have the effect of turning that line into an ordinary
source line, since the first token on the line is no longer a &lsquo;<samp class="samp">#</samp>&rsquo;.
</p>
</dd>
<dt><a id="index-CC"></a><span><code class="code">-CC</code><a class="copiable-link" href="#index-CC"> &para;</a></span></dt>
<dd><p>Do not discard comments, including during macro expansion.  This is
like <samp class="option">-C</samp>, except that comments contained within macros are
also passed through to the output file where the macro is expanded.
</p>
<p>In addition to the side effects of the <samp class="option">-C</samp> option, the
<samp class="option">-CC</samp> option causes all C++-style comments inside a macro
to be converted to C-style comments.  This is to prevent later use
of that macro from inadvertently commenting out the remainder of
the source line.
</p>
<p>The <samp class="option">-CC</samp> option is generally used to support lint comments.
</p>
</dd>
<dt><a id="index-P"></a><span><code class="code">-P</code><a class="copiable-link" href="#index-P"> &para;</a></span></dt>
<dd><p>Inhibit generation of linemarkers in the output from the preprocessor.
This might be useful when running the preprocessor on something that is
not C code, and will be sent to a program which might be confused by the
linemarkers.
See <a class="xref" href="Preprocessor-Output.html">Preprocessor Output</a>.
</p>
</dd>
<dt><a class="index-entry-id" id="index-C-language_002c-traditional"></a>
<a class="index-entry-id" id="index-traditional_002dcpp"></a>
<a class="index-entry-id" id="index-traditional"></a>
<a id="index-traditional-C-language"></a><span><code class="code">-traditional</code><a class="copiable-link" href="#index-traditional-C-language"> &para;</a></span></dt>
<dt><code class="code">-traditional-cpp</code></dt>
<dd>
<p>Try to imitate the behavior of pre-standard C preprocessors, as
opposed to ISO C preprocessors.
See <a class="xref" href="Traditional-Mode.html">Traditional Mode</a>.
</p>
<p>Note that GCC does not otherwise attempt to emulate a pre-standard 
C compiler, and these options are only supported with the <samp class="option">-E</samp> 
switch, or when invoking CPP explicitly.
</p>
</dd>
<dt><a id="index-trigraphs-1"></a><span><code class="code">-trigraphs</code><a class="copiable-link" href="#index-trigraphs-1"> &para;</a></span></dt>
<dd><p>Support ISO C trigraphs.
These are three-character sequences, all starting with &lsquo;<samp class="samp">??</samp>&rsquo;, that
are defined by ISO C to stand for single characters.  For example,
&lsquo;<samp class="samp">??/</samp>&rsquo; stands for &lsquo;<samp class="samp">\</samp>&rsquo;, so &lsquo;<samp class="samp">'??/n'</samp>&rsquo; is a character
constant for a newline.
See <a class="xref" href="Initial-processing.html">Initial processing</a>.
</p>

<p>By default, GCC ignores trigraphs, but in
standard-conforming modes it converts them.  See the <samp class="option">-std</samp> and
<samp class="option">-ansi</samp> options.
</p>
</dd>
<dt><a id="index-remap"></a><span><code class="code">-remap</code><a class="copiable-link" href="#index-remap"> &para;</a></span></dt>
<dd><p>Enable special code to work around file systems which only permit very
short file names, such as MS-DOS.
</p>
</dd>
<dt><a id="index-H"></a><span><code class="code">-H</code><a class="copiable-link" href="#index-H"> &para;</a></span></dt>
<dd><p>Print the name of each header file used, in addition to other normal
activities.  Each name is indented to show how deep in the
&lsquo;<samp class="samp">#include</samp>&rsquo; stack it is.  Precompiled header files are also
printed, even if they are found to be invalid; an invalid precompiled
header file is printed with &lsquo;<samp class="samp">...x</samp>&rsquo; and a valid one with &lsquo;<samp class="samp">...!</samp>&rsquo; .
</p>
</dd>
<dt><a id="index-d"></a><span><code class="code">-d<var class="var">letters</var></code><a class="copiable-link" href="#index-d"> &para;</a></span></dt>
<dd><p>Says to make debugging dumps during compilation as specified by
<var class="var">letters</var>.  The flags documented here are those relevant to the
preprocessor.  Other <var class="var">letters</var> are interpreted
by the compiler proper, or reserved for future versions of GCC, and so
are silently ignored.  If you specify <var class="var">letters</var> whose behavior
conflicts, the result is undefined.
</p>
<dl class="table">
<dt><a id="index-dM"></a><span><code class="code">-dM</code><a class="copiable-link" href="#index-dM"> &para;</a></span></dt>
<dd><p>Instead of the normal output, generate a list of &lsquo;<samp class="samp">#define</samp>&rsquo;
directives for all the macros defined during the execution of the
preprocessor, including predefined macros.  This gives you a way of
finding out what is predefined in your version of the preprocessor.
Assuming you have no file <samp class="file">foo.h</samp>, the command
</p>
<div class="example smallexample">
<pre class="example-preformatted">touch foo.h; cpp -dM foo.h
</pre></div>

<p>shows all the predefined macros.
</p>

</dd>
<dt><a id="index-dD"></a><span><code class="code">-dD</code><a class="copiable-link" href="#index-dD"> &para;</a></span></dt>
<dd><p>Like <samp class="option">-dM</samp> except in two respects: it does <em class="emph">not</em> include the
predefined macros, and it outputs <em class="emph">both</em> the &lsquo;<samp class="samp">#define</samp>&rsquo;
directives and the result of preprocessing.  Both kinds of output go to
the standard output file.
</p>
</dd>
<dt><a id="index-dN"></a><span><code class="code">-dN</code><a class="copiable-link" href="#index-dN"> &para;</a></span></dt>
<dd><p>Like <samp class="option">-dD</samp>, but emit only the macro names, not their expansions.
</p>
</dd>
<dt><a id="index-dI"></a><span><code class="code">-dI</code><a class="copiable-link" href="#index-dI"> &para;</a></span></dt>
<dd><p>Output &lsquo;<samp class="samp">#include</samp>&rsquo; directives in addition to the result of
preprocessing.
</p>
</dd>
<dt><a id="index-dU"></a><span><code class="code">-dU</code><a class="copiable-link" href="#index-dU"> &para;</a></span></dt>
<dd><p>Like <samp class="option">-dD</samp> except that only macros that are expanded, or whose
definedness is tested in preprocessor directives, are output; the
output is delayed until the use or test of the macro; and
&lsquo;<samp class="samp">#undef</samp>&rsquo; directives are also output for macros tested but
undefined at the time.
</p></dd>
</dl>

</dd>
<dt><a id="index-fdebug_002dcpp"></a><span><code class="code">-fdebug-cpp</code><a class="copiable-link" href="#index-fdebug_002dcpp"> &para;</a></span></dt>
<dd><p>This option is only useful for debugging GCC.  When used from CPP or with
<samp class="option">-E</samp>, it dumps debugging information about location maps.  Every
token in the output is preceded by the dump of the map its location
belongs to.
</p>
<p>When used from GCC without <samp class="option">-E</samp>, this option has no effect.
</p>


</dd>
<dt><a class="index-entry-id" id="index-iquote"></a>
<a class="index-entry-id" id="index-isystem"></a>
<a class="index-entry-id" id="index-idirafter"></a>
<a id="index-I"></a><span><code class="code">-I <var class="var">dir</var></code><a class="copiable-link" href="#index-I"> &para;</a></span></dt>
<dt><code class="code">-iquote <var class="var">dir</var></code></dt>
<dt><code class="code">-isystem <var class="var">dir</var></code></dt>
<dt><code class="code">-idirafter <var class="var">dir</var></code></dt>
<dd><p>Add the directory <var class="var">dir</var> to the list of directories to be searched
for header files during preprocessing.
See <a class="xref" href="Search-Path.html">Search Path</a>.
If <var class="var">dir</var> begins with &lsquo;<samp class="samp">=</samp>&rsquo; or <code class="code">$SYSROOT</code>, then the &lsquo;<samp class="samp">=</samp>&rsquo;
or <code class="code">$SYSROOT</code> is replaced by the sysroot prefix; see
<samp class="option">--sysroot</samp> and <samp class="option">-isysroot</samp>.
</p>
<p>Directories specified with <samp class="option">-iquote</samp> apply only to the quote 
form of the directive, <code class="code">#include&nbsp;&quot;<var class="var">file</var>&quot;<!-- /@w --></code>.
Directories specified with <samp class="option">-I</samp>, <samp class="option">-isystem</samp>, 
or <samp class="option">-idirafter</samp> apply to lookup for both the
<code class="code">#include&nbsp;&quot;<var class="var">file</var>&quot;<!-- /@w --></code> and
<code class="code">#include&nbsp;&lt;<var class="var">file</var>&gt;<!-- /@w --></code> directives.
</p>
<p>You can specify any number or combination of these options on the 
command line to search for header files in several directories.  
The lookup order is as follows:
</p>
<ol class="enumerate">
<li> For the quote form of the include directive, the directory of the current
file is searched first.

</li><li> For the quote form of the include directive, the directories specified
by <samp class="option">-iquote</samp> options are searched in left-to-right order,
as they appear on the command line.

</li><li> Directories specified with <samp class="option">-I</samp> options are scanned in
left-to-right order.

</li><li> Directories specified with <samp class="option">-isystem</samp> options are scanned in
left-to-right order.

</li><li> Standard system directories are scanned.

</li><li> Directories specified with <samp class="option">-idirafter</samp> options are scanned in
left-to-right order.
</li></ol>

<p>You can use <samp class="option">-I</samp> to override a system header
file, substituting your own version, since these directories are
searched before the standard system header file directories.  
However, you should
not use this option to add directories that contain vendor-supplied
system header files; use <samp class="option">-isystem</samp> for that.
</p>
<p>The <samp class="option">-isystem</samp> and <samp class="option">-idirafter</samp> options also mark the directory
as a system directory, so that it gets the same special treatment that
is applied to the standard system directories.
See <a class="xref" href="System-Headers.html">System Headers</a>.
</p>
<p>If a standard system include directory, or a directory specified with
<samp class="option">-isystem</samp>, is also specified with <samp class="option">-I</samp>, the <samp class="option">-I</samp>
option is ignored.  The directory is still searched but as a
system directory at its normal position in the system include chain.
This is to ensure that GCC&rsquo;s procedure to fix buggy system headers and
the ordering for the <code class="code">#include_next</code> directive are not inadvertently
changed.
If you really need to change the search order for system directories,
use the <samp class="option">-nostdinc</samp> and/or <samp class="option">-isystem</samp> options.
See <a class="xref" href="System-Headers.html">System Headers</a>.
</p>
</dd>
<dt><a id="index-I_002d"></a><span><code class="code">-I-</code><a class="copiable-link" href="#index-I_002d"> &para;</a></span></dt>
<dd><p>Split the include path.
This option has been deprecated.  Please use <samp class="option">-iquote</samp> instead for
<samp class="option">-I</samp> directories before the <samp class="option">-I-</samp> and remove the <samp class="option">-I-</samp>
option.
</p>
<p>Any directories specified with <samp class="option">-I</samp>
options before <samp class="option">-I-</samp> are searched only for headers requested with
<code class="code">#include&nbsp;&quot;<var class="var">file</var>&quot;<!-- /@w --></code>; they are not searched for
<code class="code">#include&nbsp;&lt;<var class="var">file</var>&gt;<!-- /@w --></code>.  If additional directories are
specified with <samp class="option">-I</samp> options after the <samp class="option">-I-</samp>, those
directories are searched for all &lsquo;<samp class="samp">#include</samp>&rsquo; directives.
</p>
<p>In addition, <samp class="option">-I-</samp> inhibits the use of the directory of the current
file directory as the first search directory for <code class="code">#include&nbsp;&quot;<var class="var">file</var>&quot;<!-- /@w --></code>.  There is no way to override this effect of <samp class="option">-I-</samp>.
See <a class="xref" href="Search-Path.html">Search Path</a>.
</p>
</dd>
<dt><a id="index-iprefix"></a><span><code class="code">-iprefix <var class="var">prefix</var></code><a class="copiable-link" href="#index-iprefix"> &para;</a></span></dt>
<dd><p>Specify <var class="var">prefix</var> as the prefix for subsequent <samp class="option">-iwithprefix</samp>
options.  If the prefix represents a directory, you should include the
final &lsquo;<samp class="samp">/</samp>&rsquo;.
</p>
</dd>
<dt><a class="index-entry-id" id="index-iwithprefixbefore"></a>
<a id="index-iwithprefix"></a><span><code class="code">-iwithprefix <var class="var">dir</var></code><a class="copiable-link" href="#index-iwithprefix"> &para;</a></span></dt>
<dt><code class="code">-iwithprefixbefore <var class="var">dir</var></code></dt>
<dd><p>Append <var class="var">dir</var> to the prefix specified previously with
<samp class="option">-iprefix</samp>, and add the resulting directory to the include search
path.  <samp class="option">-iwithprefixbefore</samp> puts it in the same place <samp class="option">-I</samp>
would; <samp class="option">-iwithprefix</samp> puts it where <samp class="option">-idirafter</samp> would.
</p>
</dd>
<dt><a id="index-isysroot"></a><span><code class="code">-isysroot <var class="var">dir</var></code><a class="copiable-link" href="#index-isysroot"> &para;</a></span></dt>
<dd><p>This option is like the <samp class="option">--sysroot</samp> option, but applies only to
header files (except for Darwin targets, where it applies to both header
files and libraries).  See the <samp class="option">--sysroot</samp> option for more
information.
</p>
</dd>
<dt><a id="index-imultilib"></a><span><code class="code">-imultilib <var class="var">dir</var></code><a class="copiable-link" href="#index-imultilib"> &para;</a></span></dt>
<dd><p>Use <var class="var">dir</var> as a subdirectory of the directory containing
target-specific C++ headers.
</p>
</dd>
<dt><a id="index-nostdinc"></a><span><code class="code">-nostdinc</code><a class="copiable-link" href="#index-nostdinc"> &para;</a></span></dt>
<dd><p>Do not search the standard system directories for header files.
Only the directories explicitly specified with <samp class="option">-I</samp>,
<samp class="option">-iquote</samp>, <samp class="option">-isystem</samp>, and/or <samp class="option">-idirafter</samp>
options (and the directory of the current file, if appropriate) 
are searched.
</p>
</dd>
<dt><a id="index-nostdinc_002b_002b"></a><span><code class="code">-nostdinc++</code><a class="copiable-link" href="#index-nostdinc_002b_002b"> &para;</a></span></dt>
<dd><p>Do not search for header files in the C++-specific standard directories,
but do still search the other standard directories.  (This option is
used when building the C++ library.)
</p>



</dd>
<dt><a class="index-entry-id" id="index-Wcomments"></a>
<a id="index-Wcomment"></a><span><code class="code">-Wcomment</code><a class="copiable-link" href="#index-Wcomment"> &para;</a></span></dt>
<dt><code class="code">-Wcomments</code></dt>
<dd><p>Warn whenever a comment-start sequence &lsquo;<samp class="samp">/*</samp>&rsquo; appears in a &lsquo;<samp class="samp">/*</samp>&rsquo;
comment, or whenever a backslash-newline appears in a &lsquo;<samp class="samp">//</samp>&rsquo; comment.
This warning is enabled by <samp class="option">-Wall</samp>.
</p>
</dd>
<dt><a id="index-Wtrigraphs"></a><span><code class="code">-Wtrigraphs</code><a class="copiable-link" href="#index-Wtrigraphs"> &para;</a></span></dt>
<dd><a class="anchor" id="Wtrigraphs"></a><p>Warn if any trigraphs are encountered that might change the meaning of
the program.  Trigraphs within comments are not warned about,
except those that would form escaped newlines.
</p>
<p>This option is implied by <samp class="option">-Wall</samp>.  If <samp class="option">-Wall</samp> is not
given, this option is still enabled unless trigraphs are enabled.  To
get trigraph conversion without warnings, but get the other
<samp class="option">-Wall</samp> warnings, use &lsquo;<samp class="samp">-trigraphs -Wall -Wno-trigraphs</samp>&rsquo;.
</p>
</dd>
<dt><a class="index-entry-id" id="index-Wno_002dundef"></a>
<a id="index-Wundef"></a><span><code class="code">-Wundef</code><a class="copiable-link" href="#index-Wundef"> &para;</a></span></dt>
<dd><p>Warn if an undefined identifier is evaluated in an <code class="code">#if</code> directive.
Such identifiers are replaced with zero.
</p>
</dd>
<dt><a id="index-Wexpansion_002dto_002ddefined"></a><span><code class="code">-Wexpansion-to-defined</code><a class="copiable-link" href="#index-Wexpansion_002dto_002ddefined"> &para;</a></span></dt>
<dd><p>Warn whenever &lsquo;<samp class="samp">defined</samp>&rsquo; is encountered in the expansion of a macro
(including the case where the macro is expanded by an &lsquo;<samp class="samp">#if</samp>&rsquo; directive).
Such usage is not portable.
This warning is also enabled by <samp class="option">-Wpedantic</samp> and <samp class="option">-Wextra</samp>.
</p>
</dd>
<dt><a id="index-Wunused_002dmacros"></a><span><code class="code">-Wunused-macros</code><a class="copiable-link" href="#index-Wunused_002dmacros"> &para;</a></span></dt>
<dd><p>Warn about macros defined in the main file that are unused.  A macro
is <em class="dfn">used</em> if it is expanded or tested for existence at least once.
The preprocessor also warns if the macro has not been used at the
time it is redefined or undefined.
</p>
<p>Built-in macros, macros defined on the command line, and macros
defined in include files are not warned about.
</p>
<p><em class="emph">Note:</em> If a macro is actually used, but only used in skipped
conditional blocks, then the preprocessor reports it as unused.  To avoid the
warning in such a case, you might improve the scope of the macro&rsquo;s
definition by, for example, moving it into the first skipped block.
Alternatively, you could provide a dummy use with something like:
</p>
<div class="example smallexample">
<pre class="example-preformatted">#if defined the_macro_causing_the_warning
#endif
</pre></div>

</dd>
<dt><a class="index-entry-id" id="index-Wendif_002dlabels"></a>
<a id="index-Wno_002dendif_002dlabels"></a><span><code class="code">-Wno-endif-labels</code><a class="copiable-link" href="#index-Wno_002dendif_002dlabels"> &para;</a></span></dt>
<dd><p>Do not warn whenever an <code class="code">#else</code> or an <code class="code">#endif</code> are followed by text.
This sometimes happens in older programs with code of the form
</p>
<div class="example smallexample">
<pre class="example-preformatted">#if FOO
...
#else FOO
...
#endif FOO
</pre></div>

<p>The second and third <code class="code">FOO</code> should be in comments.
This warning is on by default.
</p></dd>
</dl>

</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Environment-Variables.html">Environment Variables</a>, Previous: <a href="Implementation-Details.html">Implementation Details</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-Directives.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
